Skip to content

feat: add pagination to conversation list and history - #348

Merged
Ayinkx merged 1 commit into
AyinkxLab:mainfrom
victordice486-hub:fix/issue-36-add-pagination-to-conversation-list-and-history
Oct 15, 2026
Merged

Ayinkx merged 1 commit into
AyinkxLab:mainfrom
victordice486-hub:fix/issue-36-add-pagination-to-conversation-list-and-history

Conversation

@victordice486-hub

Copy link
Copy Markdown

Overview

This PR adds pagination to the conversation list and conversation history endpoints so that large account histories load quickly, and wires the chat sidebar to consume paginated responses via infinite scroll with a "load more" fallback. It also adds tests covering pagination bounds and defaults.

Related Issue

Changes

📄 Backend Pagination

  • [MODIFY] app/chat/api.py

    • GET /chat/conversations now accepts page and per_page query params and returns {items, page, pages, total}.
    • Conversation history endpoint paginates messages for long conversations.
    • Defaults and bounds applied to page and per_page so out-of-range values are handled safely.
  • [MODIFY] app/chat/routes.py

    • Route handlers pass through the new page / per_page params and return the paginated payload shape.

🖥️ Frontend

  • [MODIFY] app/static/js/chat.js
    • Chat sidebar fetches the next page when the user scrolls to the bottom (infinite scroll).
    • "Load more" button shown as a fallback when infinite scroll is not triggered.
    • Conversation history view requests additional message pages for long conversations.

✅ Tests

  • [MODIFY] tests/test_chat.py

    • Coverage for pagination bounds and defaults on the conversation list and history endpoints.
  • [MODIFY] tests/test_chat_api.py

    • API-level tests for page / per_page handling and the {items, page, pages, total} response shape.

Verification Results

pytest tests/test_chat.py tests/test_chat_api.py
✅ pagination bounds and defaults covered
✅ conversation list returns {items, page, pages, total}
✅ conversation history paginates messages
Acceptance Criteria Status
GET /chat/conversations supports page and per_page and returns {items, page, pages, total} ✅ Implemented in app/chat/api.py and app/chat/routes.py
Chat sidebar fetches next page on scroll to bottom (infinite scroll) or shows "load more" ✅ Implemented in app/static/js/chat.js
Conversation history endpoint paginates messages for long conversations ✅ Implemented in app/chat/api.py and consumed in app/static/js/chat.js
Tests cover pagination bounds and defaults ✅ Added in tests/test_chat.py and tests/test_chat_api.py

Closes #36

@drips-wave

drips-wave Bot commented Sep 30, 2026

Copy link
Copy Markdown

@victordice486-hub Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@victordice486-hub
victordice486-hub force-pushed the fix/issue-36-add-pagination-to-conversation-list-and-history branch from 28a79d5 to 9be7a2b Compare October 12, 2026 10:20
@victordice486-hub
victordice486-hub force-pushed the fix/issue-36-add-pagination-to-conversation-list-and-history branch from 9be7a2b to 58bc1b9 Compare October 14, 2026 15:22
@Ayinkx
Ayinkx merged commit bea43c8 into AyinkxLab:main Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pagination to conversation list and history

2 participants